package com.lebang.service;

import com.lebang.mapper.back.AppCallBackMapper;
import com.lebang.model.back.AdCallback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: hwq
 * @Date: 2021/1/4 11:15
 * @Version 1.0
 */
@Service
public class AppCallBakService {
    @Autowired
    private AppCallBackMapper appCallBackMapper;

    /**
     * 验证订单号是否存在。
     *
     * @param adCallback
     * @return
     */
    public boolean checkExit(AdCallback adCallback) {
        Integer i = appCallBackMapper.selectByTypeAndId(adCallback.getOrderId(), adCallback.getCategory().toLowerCase());
        return i !=null;
    }

    /**
     * 生成订单
     * @param adCallback
     * @return
     */
    public int createOrder(AdCallback adCallback) {
        return appCallBackMapper.insert(adCallback,adCallback.getCategory().toLowerCase());

    }
}
